package cn.bearspark.currency.provider.rpc;

import cn.bearspark.currency.dto.CurrencyBaseInfoDTO;
import cn.bearspark.currency.provider.service.CurrencyService;
import cn.bearspark.currency.rpc.CurrencyRpc;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Component;

/**
 * @author f
 */
@Component
@DubboService
public class CurrencyRpcImpl implements CurrencyRpc {

    private final CurrencyService currencyService;

    public CurrencyRpcImpl(CurrencyService currencyService) {
        this.currencyService = currencyService;
    }

    @Override
    public CurrencyBaseInfoDTO getBaseInfo(long userId) {
        return currencyService.getBaseInfo(userId);
    }

    @Override
    public void initCurrency(long userId) {
        currencyService.initCurrency(userId);
    }

    @Override
    public boolean deductMerit(long userId) {
        return currencyService.deductMerit(userId);
    }
}
